<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/" py:strip="">

    <py:match path="head" once="true">
        <head py:attrs="select('@*')">
            <title py:with="title = list(select('title/text()'))">
                <py:if test="title">${title}</py:if>
            </title>
            <link rel="icon" href="/static/images/favicon.ico" type="image/png" />
            <meta content="text/html; charset=UTF-8" http-equiv="content-type" />

            <!-- Stylesheets -->
            <link type="text/css" rel="stylesheet" media="screen" href="/static/css/tabber.css"></link>
            <link type="text/css" rel="stylesheet" media="print" href="/static/css/print.css"></link>
            <link type="text/css" rel="stylesheet" href="/static/css/autocomplete.css"></link>
            <link type="text/css" rel="stylesheet" href="/static/css/style.css"></link>
            <link type="text/css" rel="stylesheet" href="/static/css/menu.css"></link>
            <link type="text/css" rel="stylesheet" href="/static/css/sortable.css"></link>
            <link type="text/css" rel="stylesheet" href="/static/css/list.css"></link>
            <link type="text/css" rel="stylesheet" href="/tg_widgets/turbogears.widgets/calendar/calendar-system.css"/>

            <!-- System JS -->
            <script type="text/javascript" src="/static/javascript/MochiKit.js" ></script>
            <script type="text/javascript" src="/tg_widgets/turbogears.widgets/autocompletefield.js"></script>

            <!-- Tabber JS -->
            <script type="text/javascript" src="/tg_widgets/turbogears.widgets/tabber/tabber_cookie.js" ></script>
            <script type="text/javascript">
                try {
                   tabberOptions
                } catch(e) {
                   tabberOptions = {};
                }
                tabberOptions['onLoad'] = tabber_onload;
                tabberOptions['onClick'] = tabber_onclick;
                tabberOptions['cookie'] = 'TGTabber';
            </script>


            <!-- Calendar JS -->
            <script type="text/javascript" src="/tg_widgets/turbogears.widgets/calendar/calendar.js"></script>
            <script type="text/javascript" src="/tg_widgets/turbogears.widgets/calendar/calendar-setup.js"></script>
            <script type="text/javascript" src="/tg_widgets/turbogears.widgets/calendar/lang/calendar-ru.js"></script>

            <!-- Mnemoply simple JS -->
            <script type="text/javascript" src="/static/javascript/menu.js"></script>
            <script type="text/javascript" src="/static/javascript/utils.js"></script>
            <script type="text/javascript" src="/static/javascript/sortable.js"></script>
            <script type="text/javascript" src="/static/javascript/ajax.js"></script>

            <!-- Toolman sort and drag JS -->
            <script type="text/javascript" src="/static/javascript/tool-man/core.js"></script>
            <script type="text/javascript" src="/static/javascript/tool-man/events.js"></script>
            <script type="text/javascript" src="/static/javascript/tool-man/css.js"></script>
            <script type="text/javascript" src="/static/javascript/tool-man/coordinates.js"></script>
            <script type="text/javascript" src="/static/javascript/tool-man/drag.js"></script>
            <script type="text/javascript" src="/static/javascript/tool-man/dragsort.js"></script>
            <script type="text/javascript" src="/static/javascript/tool-man/cookies.js"></script>

            ${select('*[local-name()!="title"]')}
        </head>
    </py:match>

<?python
    import datetime
    from turbogears.i18n import gettext as _
    from mnemoply.utils import parse_flash
    from mnemoply.widgets import Mainmenu

    april     = 4
    september = 9
    today     = datetime.date.today()
    is_summer = april <= today.month <= september
    groups    = tg.identity.groups
    XXX = Mainmenu()
?>

<py:match path="body">
<body py:attrs="select('@*')">
    <script src="/tg_widgets/turbogears.widgets/tabber/tabber-minimized.js" type="text/javascript"></script>
    ${ET(XXX())}
    <div id="wrap">
        <div id="pageLogin">
            <span py:if="tg.identity.anonymous">
                <a href="/login">Login</a>
            </span>
            <span py:if="not tg.identity.anonymous">
                <span>${tg.identity.user.display_name or tg.identity.user.user_name}</span>
                (<a href="/logout">Logout</a>)
            </span>
        </div>

        <div py:if="tg_flash" class="flash" py:content="parse_flash(tg_flash)"> </div>

        <div class="center" id="local-menu" py:if="defined('local_menu') and (len(local_menu) > 0)">
                <span py:for="mi in local_menu" py:if="mi.isShown()">
                    <a  href="${mi.href}" onclick="${mi.get('onclick', '')}">
                         ${mi.caption}
                    </a>
                </span>
        </div>
        <div class="center" id="content">
                ${select("*")}
        </div>
    </div>
    <div id="footer"></div>

</body>
</py:match>

</html>
